<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	请输入年份：<br>
	<input type="number" id="year"><br>
	请输入月份：<br>
	<input type="number" id="month"><br>
	请输入日期：<br>
	<input type="number" id="day"><br>
	
	<button id="judege">判断</button>

	
</body>
</html>
<script>
	var yearInput = document.getElementById("year");
	var monthInput = document.getElementById("month");
	var dayInput = document.getElementById("day");
	var judegeBtn = document.getElementById("judege");

	var jan = mar = may = jul = aug = oct = dec = 31;
	var apr = jun = sep = nov = 30;
	var feb = 28;


	judegeBtn.onclick = function(){
		var year = yearInput.value;
		var month = monthInput.value;
		var day = dayInput.value;

		var r = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;

		 if (r) feb += 1;


		 day = day - 0;

		 month = month - 0;

		 var wd = 0;
		 switch(month) {
		 	  case 1:
		 	       wd = day;
		 	       break; 
		 	   case 2:
		 	       wd = jan + day;
		 	       break;
		 	   case 3:
		 	       wd = jan + feb + day;
		 	       break;
		 	    case 4:
		 	       wd = jan + feb + mar + day;
		 	       break;
		 	    case 5:
		 	       wd = jan + feb + mar + apr + day;
		 	       break;
		 	    case 6:
		 	        wd = jan + feb + mar + apr + may + day;
		 	        break;
		 	     case 7:
		 	        wd = jan + feb + mar + apr + may + jun + day;
		 	        break; 
		 	     case 8:
		 	        wd = jan + feb + mar + apr + may + jun + jul + day;
		 	        break;
		 	     case 9:
		 	         wd = jan + feb + mar + apr + may + jun + jul + aug + day;
		 	         break;
		 	     case 10:
		 	         wd = jan + feb + mar + apr + may + jun + jul + aug + sep + day;
		 	         break;
		 	     case 11:
		 	         wd = jan + feb + mar + apr + may + jun + jul + aug + sep + oct + day;
		 	         break;
		 	      case 12:
		 	         wd = jan + feb + mar + apr + may + jin + jul + aug + sep + oct + nov + day;
		 	         break;
		 	      default:
		 	         break;


		 }


		 alert("这是一年中的第" + wd +"天");





	};






</script>